package com.wdc.deliveryrobot.decoration;

import android.graphics.Rect;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class SpaceLeftDecoration extends RecyclerView.ItemDecoration {
    private final int space;

    public SpaceLeftDecoration(int space) {
        this.space = space;
    }

    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
                               @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        outRect.left = space;   // 设置每一项顶部的间距
        outRect.right = space; // 设置每一项底部的间距
    }
}